using System;
using System.Collections.Generic;
using UnionAssets.FLE;

public class IOSStoreProductView : EventDispatcherBase
{
	public const string PRODUCT_VIEW_LOADED = "product_view_loaded";

	public const string PRODUCT_VIEW_LOAD_FAILED = "product_view_load_failed";

	public const string PRODUCT_VIEW_APPEARED = "product_view_appeared";

	public const string PRODUCT_VIEW_DISMISSED = "product_view_dismissed";

	public Action Loaded = delegate
	{
	};

	public Action LoadFailed = delegate
	{
	};

	public Action Appeared = delegate
	{
	};

	public Action Disnissed = delegate
	{
	};

	private List<string> _ids = new List<string>();

	private int _id;

	public int id
	{
		get
		{
			return _id;
		}
	}

	public IOSStoreProductView()
	{
		foreach (string item in IOSNativeSettings.Instance.DefaultStoreProductsView)
		{
			addProductId(item);
		}
		ISN_Singleton<IOSInAppPurchaseManager>.Instance.RegisterProductView(this);
	}

	public IOSStoreProductView(params string[] ids)
	{
		foreach (string productId in ids)
		{
			addProductId(productId);
		}
		ISN_Singleton<IOSInAppPurchaseManager>.Instance.RegisterProductView(this);
	}

	public void addProductId(string productId)
	{
		if (!_ids.Contains(productId))
		{
			_ids.Add(productId);
		}
	}

	public void Load()
	{
	}

	public void Show()
	{
	}

	public void OnProductViewAppeard()
	{
		dispatch("product_view_appeared");
	}

	public void OnProductViewDismissed()
	{
		dispatch("product_view_dismissed");
	}

	public void OnContentLoaded()
	{
		Show();
		dispatch("product_view_loaded");
	}

	public void OnContentLoadFailed()
	{
		dispatch("product_view_load_failed");
	}

	public void SetId(int viewId)
	{
		_id = viewId;
	}
}
